#ifndef ALFS_GUI_WINDOW_H
#define ALFS_GUI_WINDOW_H

// File [alfs/gui/Window.h].
//
// Window.
//
// A Window is a rectangular region, possibly with a non-rectangular presentation, that
// can receive messages such as keyboard events, mouse events and internal events.
// Windows instances form a strict ownership hierarchy.  An owned window can be
// embedded in the owner window, and is then conventionally called a child window (with
// the owner as parent), or e.g. control (Windows) or widget (*nix).  Or it can be separate
// but in front of the owner, and is then/ conventionally called a popup window.  A popup
// window that has the imaginary root owner as owner is conventionally called a top-level
// window, main window or e.g. a "frame" window  --  a process can have zero, one or more
// top-level windows, although some frameworks insist on exactly one main window.
//
// (c) copyright Alf P. Steinbach 2008.
// Use, modification and distribution are subject to the "New BSD License"
// as listed at <url: http://www.opensource.org/licenses/bsd-license.php>.

#include    <alfs/pointers/NotifyingPtr.hpp>
#include    "command_stuff.h"       // alfs::InvocableUserCommand etc., + shortnames

namespace alfs{

#   define ThisClass    Window

    class ThisClass
    {
    protected:
        virtual ~ThisClass() {}

    public:
        enum VisibilityEnum{ hidden, visible };
        typedef InvocableUserCommand::Action    Action;

        template< typename Derived >
        Action action(
            void (Derived::*pMemberFunc)(),
            typename boost::enable_if< alfs::IsConvertibleFromTo< Derived*, ThisClass* > >::type* = 0
            )
        {
            return boost::bind( pMemberFunc, &dynamic_cast<Derived&>( *this ) );
        }
    };

    inline ThisClass::VisibilityEnum operator!( ThisClass::VisibilityEnum const v )
    {
        return ThisClass::VisibilityEnum( v == ThisClass::hidden );
    }
#   undef   ThisClass

}  // alfs

#endif
